Memory leak fix

Stops retaining removed html elements