Basic reference implementation.