Added lock for thread safety