Added "finally" feature for cleanup/teardown
refactor