Style and typedef changes.

No logic issues, only some style and typedefs changes to pass gjslint --strict and Google Closure Compiler advanced flag. This style might not be compatible with your project style.