The following C# code works fine but its totally awful and i know there will be much better ways to do it, if it were PHP i could easily condense but this is the extent of m