make the addservice function more generic, added test comments