Code cleanup.
Added destroy notify handler. To be finished.