lots of changes

fixing some marshalling issues,
moving Topic and Subscription into their own package,
adding some example tests