bug fixing done. now does not depend on the choice of tau.