refactor request handlers