More file cleanup and refactoring