item inserting fix and white space refactoring