Problem 2, first impl
A bit more concise