Updated code to match new API docs (mostly)