Add some more comments, split overly long lines
Replace cat() by message() where appropriate

This is much more programmer friendly in case someone wants to access the rest api programmatically, because the
message() function can be redirected/overridden. See also http://www.r-bloggers.com/bad-kitty/. Only the authentication
dialog uses cat since it should not be overridden.
Refactor progress bar/display into callbacks

Split up the UI code and the download- and parsing code into separate functions instead of single functions that deal with both.
The download- and parse functions now take callbacks that they use to display progress. The old behavior is put in default callbacks
so there is no change for users.

Rename `count` to `length`