Move testcode.
Comments and some random fluff.
Divide type and reference check tests in several files.