minor refactorings fixed