Cleaner code, better error reporting. (Reporting could still use improvements.)