added logging earlier