cleaned up code. added RF functionality