add method to get file and remove redundancy in script