Big changes to midpoint

Midpoint calculation completely different. Hopefully working.