removes errors in filename making, cleans up some extra code