Added some comments so code becomes a bit more readable.