refactored the overlayManager.