moved query to backend