changed if else to case statement
extracted input commands into own method