added some mutex and cond. Notworking
Small error with calls during sleep