Rework coordinates

Branch is stable, needs merging with master.