made jquery code more standard compliant