moved some functionality into a separate object. refactored processing queue of commands