refactorings and bug fixes