Beggining of data get loop code