working to spec, added error messages