General minor refactoring