Refactore calculate action