added -inv flag