Some more restructuring / refactoring