Unit test and cleanup