Implemented Q.request and refactored code to use it