refactored Vertex class