some refactorings and updates