refactoring & tmp workaround to allow close.