Refactoring, return exceptions, eachWithIndex