added multiple edge code; replaced double edge stuff