completed assignment with test function