passes jshint ( mostly )