This is mostly done not tested thought