finished basic RF code