Reimplement inverse calculation