Use jQuery deferred execution