Updated. Changed inv function for \