refactoring phase 3 (continue)