separated inversion logic into new file geom.js