added handling for invalid commands