Added Global Reference support.
Crom: changed on_clean to be on_destroy.