Refactor code to remove all behavior to command class