corrected sleep function - now it's not using 100% of a sincgle CPU core