refactor to avoid jshint