reverted moving SQL to top of the file
removed sql at top of files