refactoring to satisfy my jshint rules