new absolute threshold algorithm and added unit tests