Restructured code performing tests