Added comments through the code.