Fleshes out analyze function