Dirty and DRY patch for #49, inventory.js needs to be massively cleaned up