added cookie, improve promises and http