Refactor cartridge model code