Reorganized testing code.