dont ask me to explain mangleMatrix. :)