implement determinant of matrix, other cleanups