removed debug printouts
extended loops