moved filename out of functions