Changed logging loop