The javascript part is started to be documented and refactored