Changed 'state' for thread-safety