Improved an error message and killed some dead code.