Added teardown handling. Console/runtime todo