Cleanup test_lib a bit, still needs work.