dispose refactor