calculating with functions