Generic cleanup and simplifications.

Just some really generic things that simplify existing code among other things.