Moved command execution to a separate class