JSHint-ignoring the methods that I ripped from node-oauth - I don't want to change these too much. Also a complexity reduction and variable shadowing fix.