Changed some of the code