added a switch-statement instead of muliple if-statement