For #152: refactor resolve resolution algorithm
Refactor: move more binds code to Scala
Remove unneeded custom XML code