refactoring in Form1.cs