Small refactorings, improvements