Added logic to retrieve error log details + refactoring.