updated build_vertex to use get_index