Adding code from cs571 to repo.