Code tidy #1

No real changes just the start of some tidying up.