Typos corrected, some output beautified, no functional code changes