Added debug statements and switch.