added first attempt of inverse implementation