Converted commands to switch statements to be more efficient than
if-then-else