slight refactor of PrepFiles