Dev

Tests added and some small changes to the internals for more modular development.