revised mutexes; clean code