Add support for imports.

It is quite dirty, as I had to do some stuff with a custom reader.
I found that loading imports from the java file is too slow and fails when the file is not proper java.
So now the imports are stored in the .cookie file,
but that made reading it into the document a lot harder...