i have been trying to factor things out where it makes sense rather than trying to force it into ugly little funcs with no other use or easy testing  the failed file logic at the end i can prob move out easily