restructed sql query builders to be independent of initialization