Fixed usedef for parameters

Fixed an issue in usedef where parameters were not getting checked.
Also started type checking system.