Copied logic of cmdradio (cmdradio.codeplex.com). First working version of library