implemented CommandExecutor for executing commands and handling exceptions