Added the logging part