refactor tag rendering, add spec