Several refactorings applied