Code is now faithfull to the book's code