first refactoring towards modules