addded proper logging