some refactoring necessary after merge