Move command handling to a separate CommandHandler