Refactor ownercheck functions