Add first tests
Bring back mutex and add comments