refactored radio code to be simpler