added teardown logic