fix separator reduction to single underscore and trim leading as well as trailing separators from output