RF: split function into separate components, unfinished