Move avp_id to status table + refactoring