Made graph update when appropriate (and nicer than before)