Fixed rotations and inversions. NOT TESTED! It compiles but of course something is wrong. :)