JS small refactor.