Adapted to JS re-organization.