Minor improvement, bug fixes and style changes.