More idiomatic Ruby
Added comments
Refactored to use :keep for keeping the list after the initial read.