calculate function look ok... compiles