Added comments on most methods and fixed the NoRefferenceException problem.