Refactoring

*reduce duplication using an each loop
*introduce an item class