new version using the fast algorithm from the NFM submission.