Changed test implementation to use deferred/promise rather than callback style