I added a few minor comments but otherwise it looks good to me. @tristantarrant, what do you think?

@mlinhard You should put add the rest module commit to this PR to make it easier to review.