added output to JSON
refractored getting file by date given new format