after some refactoring...