Implemented map without the need of Promises.