refactoring HttpPromise to follow Stateful pattern and using declare function. Fixed a bug on demo page3