Moved state into Promise
Works but not perfectly yet
Moved Deferred and Promise to same file so Deferred object has access to private properties and methods of Promise