Deleted own SQL and added logging lines.