Improve library with chain sorting and multi-tags