Can Someone help me fix this messy code and simplify it. - C#