Changed queries to reduce named queries