add priority, better handling of error messages