JS re-organize