getting filename refactor