Initial revision of the overlays code