Refactored some of the older code to look more like the new stuff for consistency.