Refactor using File.basename