General cleanup - fixing up some of the hackiness