reduced code in controller using switch instead of ifs