Started tidying up code everywhere