added gain slider, some comments, reorg