Refactored promise app