more fixes and formatting etc.