Refactor, use SQL to read the version of the file to improve load speed