refactor handlers