Style changes and minor bug fixes