Allow to pass a candidate list.

Also add tests for this feature.