boyer more algorithm implementation