implement rm function.