Great refactoring as suggested by Ben.