better error messages and error checking. Still a lot to be done.