logging logic added