Refactor request logic