adding the code that gives good results