Bug fixed: Fixed some minor bug. Still got a lot and the final graph is wrong.