Refactor audittrail