Add stats, test for errors, clean up.