invert function

An S3 method for inverting a step