added logic for getting files