Change filename parsing code slightly