Some cleanup, restore function to create new layer