Use internal ids.
Add get_tree().
Fixes in JS url handling.