adding garbage collection to remove memory leaking