ref stats files mostly working, sql updates required tho