Update viewer.js

code review