[OE-2682] Move address logic out into a separate class and add tests.