Let's embrace Test Driven Development
You are not allowed to write any production code unless it is to make a failing unit test pass.
You are not allowed to write any more of a unit test than is sufficient to fail.
You are not allowed to write any more production code than is sufficient to pass the failing test.
1.Create a failing Unit test.
2.Make the test pass.
3.Refactor your mess.