refactor bigraph