Error messages to STDERR and other changes to improve readability