Added functionality for chaining queries