fix subscription server  bug introduced when porting to async, add support for event in server, reorganization

lots of changes. I should have tested more but there are so many changes it is better to merge otherwise it will be hard to merge
I completely agree. But I thought it would help to take headers out.