added parameter for looping the last frame forever