Refacotring JS-SDK