Restructuring to allow for more informative errors