fixing tabs indentation etc
fixed various nits
following node.js idiomatic patterns wherever possible, cleaned up reauth such that only x-auth-token is replaced