Yikessss bash wowow this is complicated.