Added comments and did some cleaning.