Frequency input bug fixes.
Generalized LSR alg. and took of self-tuning.