work on bmf graph and code restructure