variable setup

variables are set up and conditionals are added for different
calculation