finalized test code