Cost function modified, added error rate