improved jquery handling