bits from http://ruby.learncodethehardway.org/