final changes and bug fixes, and more style tweaks