Parthnaik refactored js