trying to solve noise issues and improve algorithm

too much stuff to solve. added some comments, but maybe  i should try
those improvements after the paper is sent