use a block instead of do..end
extract parsing stuff to separate class