Refactor/fix graph disappearing