Added Error Logging