finish writing the errhandle mechanism, need debugging next