finish chapter 2.4

finish 2.4; use scalariform to format code