added stuff from chapters 3,4,5