Fixed garbage collection and rotation matrices