First try for refactoring