Merged some of of the tutorial by Kevin A Stone code into mine. Things are pretty messy at the moment.