Improved some graph method

Now the code seems cleaner :)