some refactorings to get a cleaner package structure