rr and some generic func definitions