Chapter 4 almost complete

Maybe other functionalities are necessary.