use smarter determinant function
add determinant test
refactor determinant code and tests