Edit JS according to code-review