Implemented disposal logic.