added instantiation functionality
added query cancellation