refactored ownership code