refactored sql strings