Added double protection as .clear didnt seem to want to work