thread execution starts here and runs as long as the applicationin each loop the scalefactor is halved till the optimal resolution has reached