refactoring of some stuff out of rt module