added code to logging