some initial refactoring (towards proper submoduling)