Token-aware tests and fixes
Merge branch 'CPP-149-rebase' into beta5