move filename replacement to another function so it can be called manually