Type refactoring

Refactored the mirror type to make it easier to understand, and use it.