everything except storing previous queries working