reverted to rname
fixed problem with _ot and rname
simplified logic