Refactor end in processs