Refactor library entries querying.