cabac code refactoring