library sorting working