Exception implementation coded. Code refactoring. Exception handling.

Signed-off-by: Paolo Maresca <plo.maresca@gmail.com>