Added a learning adaptive threshold.
Added a comment