added instantiate method
added tests for instantiate
improved tests