Promise flatten / refactor

This PR refactors the existing promises to a more idiomatic bluebird style. Please test extensively before merging, no functionality should have changed but I couldn't get the tests to run properly (before the refactor or after). I also came across a mixture of tabs and spaces in the files and needed to choose, so I chose (2) spaces because that seems to be most prevalent in the JS community. Sorry if I offend any religious tab fanatics with this :smile:. Regardless the code is now quite a bit shorter and hopefully more readable.