Refactoring stage1