First two chapters' coding exercises