Refactor request() to improve performance