Added commenting and removed unused clear_overlay() function