Updated promise implementation. it was baaaad before