refactored javascript client into hierarchy of participant types.