Improve event model using deferred and promise