fix and refactorings