removed dependency on scipy