Refactored SQL queries to abstract file path