min max multithreaded implemented