moved reporting into its own function and cleaned up the error messages