Added misisng threads linking
Added release flag to optimize with -O3