First version of code, not working
First working version