Refactor disposal logic.