Adding sql schema and fixing some variable names.