smart logic added