Updated 'mirror' function