Added 'some' comments to the code so it's a bit easier to follow... probably too many, but they can easily be removed