Fix another regression; More refactoring