Refactoring of promises and error handling
More refactoring of error handling
More refactoring of promises. Better error handling.
Fix bugs and JSHint errors
Update tests to remove unneccessary waitForAngular calls