Warren's attempt at refactoring