Added more comments for JS functions