refactoring on apply_mirror()