Refactoring build promise