fixed issue with directorys not being read
easier understood variables, make jshint happy