This is not thread-safe, but I am not sure if it has to be.