finish chap 8, add function prototypes