refactoring items.c and items.h