Added comments and re-factored some code by StyleCop recommendations.