Rewrote code from ex02