Making the calculation part independent

LLM is not good at calculating for now. Moving the calculation part to a separate function makes it easier to develop and maintain.

Last updated