Implemented mirror, fixed some bugs