(copy) corrected javascript