misc refactorings