Fixed bug where we were generating candidates based on V_0 rather than
V_t-1.

Added python reference implementation.