refactored testing code. in preparation for more test cases.