Fixing modularity issues

No new functionalities, only refactoring the code