refactoring align_with method