Indented and cleaned up with JSLint.