A few fixes, and tidy up