Rewrote test code to use the perl script. Added subroutines to boilerplate code.