Fixing generation of states for lists and adding whitespace at the beginning of the input.