APD-54: fix JavaScript code style.
APD-54: refactor code

  - remove commented code
  - change println to log.debug