changed from jQuery promises to Q