Setting up function, assigning variables, making calculations