threshold estimation is working
needs improvement on accuracy