Refactoring out some more reusable code across themes/documents.