Fixed messed up parameters and code