Added a bunch of explanatory comments