style changes and bug fixes