Refactoring
* Reduce duplication using an each loop
* Introduce an item class to hold information about an item