refine code base on jslint