move not strictly tests to main code (probably temporary)