implemented simmilarity, optimized tag queries