Complete refactoring to make it more maintainable; Added missing comments; Added command interface; Created service interface;