algorithm added.
minor modified