object restructuring part 2: make vertex a class