further work on upgrading to SQL