added better comments into JS code