analysis logic