Implement calculation of variables