remove comments and use switch instead of if