Refactor result processing into a method by itself