refactored command handler framework