Changes to overlay function