Added logging and Exception handling
Adding more logging and exception handling