Promise/A+ implentation