Merge diffs for issue 115, support role attribute. Did this by hand.