some refactoring \chebert