Refactor parser switch into operation functions