made RF less complex
working code.