Refactoring to make things more declarative.