move Deferred and Promise functions to prototypes