nat handler refactoring