Added comments. Apologies if you don't like in-line comments