Some further refactoring