Adding code exerpts from ex1 & 2