adding edges to factors; other fixes