Repaired javascript