some general refactorings