Rewritting some code as http://namelivia.com/reviewing-old-ruby-code-practical-use-of-blocks/