updated promise to 2.2
refactoring