A plot added, change the structure of the code