some simple refactoring to remove unused references.