Added reference to where I got the code from