Arrange and comment Javascript code