Break apart bbc into functions and use local variables.