Restored old SQL to prevent conflicts with Marc's new SQL code.