made error testing inline so i can see where they happen