Cleaned up code to work with new file names. Also added handling for 'as at' time period term