Added some comments explaining my code.