Refactoring phase 2