Added a new version that's maybe a bit more idiomatic with an object and for comprehension.