Tidy up. Fix bugs.