replaced if-elseif-else with case in commnad processing for better readability