Added collision detection for vertices