Minor refactoring to support clean integration with distributed django module.