Implements Exception handling