Yes, returning from a function would be cleaner imo than breaks inside of nested for loops.