Promise-based solution for Assignment 3