Revision #3

Created a base class for Exceptions. Cleaned and semplified some
funtcions