Using OO to create adjacent list