Whitespace and formatting cleanup.
Some API fixes so the old API methods taking usernames will still work.