Minor fixes/refactoring.