more work on doAlg
minor work