few modifications. large amplitude case seems to be working.