updated cycle javascript