Removed custom error function and replaced it with standard logging module.