various refactorings