small changes. Better output control