Implement query system in server