Minor: remove extra xh:body
Refactor: move RuntimeBind to Scala
Refactor and test

- move BindNode
- use Scala collections where possible
- clarify code
- test for bind resolution algorithm