Slight cleanup and refactoring.