Working implementation of BAL as in paper