refactored to create function for checking for missing items; also fixed security flaw in addAddress function