Changed the unused error_function to an error probability variable.