About the unittest: Yes I will add one. It will also be helpful for the refactoring.
About the refactoring itself: See my comment above. I will do it in a separate iteration.