Fixes #20: auto sort context and tree trees