tidyup code, indentation etc