implementing calculations