renamed loop function to jquery convention because of consistency