Lots of improvements on test framework