Refactored SQL functions into separate classes
Merging changes