Now using PROGNAME in error messages
Code cleanup