Added some code comment to clarify functionality.