added cleanup(). Need priliminary tests.