Add toList function.

Unify variable names across functions.