updated reg javascript