Rewrite to better effect for memory leaking control