Adding queries on index and fixing limit bug.