basic implementation of rm