Fix incorrect mirroring, and a few other general tweaks