Added Command pattern implementation with supporting refactoring.