Refactored the way commands get built and executed to address race condition issues. Also exposed Command.next method to simulate the existing callback style.