some refactoring & remove warnings & use build graph in external module