refactor code and chages store file name variable