Added function from hw2-ex18