Implemented jQuery promise and some other methods.

Implemented jQuery promise and some other helper methods.