implementing BM and Sunday algo