working on better error messages and missing lib functions