Refactor Overlay Code