Getting filenames in a central function for less duplicate code