Improved error handling.

- Added more try/catch blocks for improved error handling. (Errors being when a nonsingular phi matrix is not found.)
- Cancelled effort to have function calculate rank of matrix, since this does not seem straightforward with GSL. Rank will be found when matrix is reduced to full rank.
- Added additional memory clean up (freeing memory of intermediate matrices during loops).