Added code for figures of chapter 5