Initial copy from homework.