Begin refactoring handler code