Refactor result handlers