output formatting tweaks and bug fixes