Calculate T has been moved into its own function