file refactorings and clean up