A bit of refectoring and such.