Updated so that commands don't clobber each other and promises work correctly
TODO: add validation