working code with rest overlay