added error and exception handlers; added logs