Replace some of the major uglyness with a nice tidy wrapper.