Refactoring a little code.