Refactoring

per Mike - Reduce duplication in each loop
introduce an item class to hold information about an item