Clean up imports, add logging if exception.