add flag to toggle errors, cleanup

completes #1