done with cummin and cummax, added personal error to rerror