added logging functionlaity