Why not use the `hideOverlay` function, instead of repeating this code?