change remove to take type, hrn parameters; fix problems with error reporting