small refactorings and formatting issues