adapted mirror script