Allow user to set number of errors

Final point to resolve #365