Refactor - sql strings
Small fixes