disposal function, doesn't work correctly yet