Corrected javascript