Refactor the mirros code