Remove unused cancel and error in config and code. Other minor code enhancements.