removed extra code from perl and got js working