Changes to the model

- fixed bug in postmessage
- more consistent use of Origin
- s/url2origin/origin
- other misc fixes