adjacency list method almost finished