cleaned up vertex and edge creation code, simplified