Refactors and makes it stylecop compliant.