Adds cleanup and more accurate setup to unit test.