Based of learning from Eloquent Ruby.