Cleanup inventory.js code a bit more, pull out some functionality into InventoryModel.
A tiny bit more cleanup.