adding documentation.

fixing jshint.

adding "resolve credentials" logic.