Analysis Function almost done