added extract domains function