Help with optimisation - C#