Moved functions around to better fit the model we will be using