Catching situations where target state is not defined.

Example:

P = (a,x).B; and B is not defined anywhere.
Got rid of exit(1) in lib, changed to generic Exceptions
Raise exception when variable not defined
Checking whether variable has been already defined
Merge branch 'cli' into dev