modify bresham using my own methods good but slow