some more refactoring + support for mirrors