tidyup and formatting