Function Caluclater