Cleanup .markDirty() situation. Split inventory functions needed to be refactored into separate file