Changed some of the parameters and function calls