Added thenOpen casper function