Improve path => tag generation string mapping algorithm