handle builtin and token sorts more generally in the java backend
make directory structure slightly more sane