better way to do this? - C#