fix typos in comments
reduce switch statement