handler refactoring