Refactor item code into item class