Major refactor of promise to use trampoline to handle queuing tasks rather than using setTimeout