adapted queries for crate