Did a little cleaning up and refactoring.