bern.py move algors to below