Added comments for clarity

I've added comments at all the major parts of the code to prevent
confusion (hopefully)