some modification to graph and search
some names changed for better