Minor corrections and added sample output and inverse caculation checking