Updated to include simpler function

Removed ginv, replacing with solve.