Pass account JSON object in directly instead of setting window global variable.

White-space and general code cleanups.