lots of coding style fixes