Started tidying code up