making rhd2arf.m a function