Lots of tidying up of code