code refactor of rtmedialike