added test for nested loops plus implementation