Fixed (hopefully) analyitcs code