JS version now working.