inverse code

added inverse code with comments