move filename init up to remove dup code

as suggested by @jlee-r7