Implemented tags sorting mechanism.