Minor refactorings and whitespace fixes
Merge branch 'feature/core-refactoring'