improved rm functionality