tag search, small refactor