Modified number to list function