various style changes and bug fixes