Restructure testing mode.
Reintegrate functions into specs.