added logging in logic