Added mutexes
First approximation of a test, with some extra goodies added