Various coding style and efficienct changes.