some tidy up, but a major change to config