committed all the code from the chapter