Added Graph class, pathExists functionality, cleaned up code