Added some comments explaining wtf is going on.