add calculate function