Cleaned up code by making a struct that has all of the variables the need to be passed