Corrected small errors in logic -> suddenlu it works