Refactor Promise using classes.