Cleaned up command processing