Updated blas routines and fixed memory leak.