added destroy func and added some comment