add mirror function and sample