refactoring, better address location handling