Changed modular structure and layout. Added/cleaned up tests