initial solution, and ruby-esque method one-liner solution too