before converting to jQuery