Changed logging algorithm