Refactor Machine as a simple container for locks instead of having to lock the whole thing all the time