Added switch statement to handle commands