Moved the lock to a class decorator to track state

I think this should work