some refactoring, no major changes