Added remove layer feature to unload function.