Take loop no as a parameter.