Added state checking to promises
Revised command API to use promises; moved to concurrency module.
Fixed use of promises in corecommands