Pre-refactoring version