added logging code