Added some calculation functions