More cleanup. This time with error handling. That should be about it for cleanup for now.