calculate method