moving extra query to library.