Cleaned up candidate generator code.