more changes for refactoring and naming conventions with sql