rewrote everything for perm_id's