added graph and some refactoring
continue working with graph