Changed SQL to match altered database tables.