Trying to use a better package structure
Avoid package cycles and some cleanup.
Some cleanup of tests.