Tidy up some, introduce interfaces