added loop support for algo