Added print graph function
Renamed a lot of variables for clarification
Overall check of code
To be tested...