refactoring in bre.c