added primary address handling to controllers
implemented primary address handling and tests