added saveItem() to lib.js