refactors the parse switch statement slightly