refactor to use response handlers