Refactoring, split code in different class.