More work on ec

I fixed what I think is most of the bugs. The remaining issue is that
given two points A and B, A+B != B+A