code refactoring, create test code