Fixes affiliation changes

Current code does not parse the HTTP body. It also verifies for correct affiliations names, which, IMO, should be a job for the channel server. I also did a few minor changes to make the code cleaner.